package com.fulihui.systemcore.dal.convertor;

import java.util.List;
import java.util.stream.Collectors;

import org.springframework.beans.BeanUtils;

import com.fulihui.systemcore.dal.dataobj.PosAreaDO;
import com.fulihui.systemcore.dto.PosAreaDTO;

public class AreaConv {
    private static final String[] ignore = { "id" };

    public static PosAreaDO convert2DO(PosAreaDTO mo_) {
        if (mo_ == null) {
            return null;
        }

        PosAreaDO do_ = new PosAreaDO();
        BeanUtils.copyProperties(mo_, do_, ignore);

        return do_;
    }

    public static PosAreaDTO convert2DTO(PosAreaDO do_) {
        if (do_ == null) {
            return null;
        }

        PosAreaDTO mo_ = new PosAreaDTO();
        BeanUtils.copyProperties(do_, mo_, ignore);

        return mo_;
    }

    public static List<PosAreaDTO> convert2List(List<PosAreaDO> list) {
        return list.stream().map((t) -> {
            return convert2DTO(t);
        }).collect(Collectors.toList());
    }
}